//-----------------------------------------------------------------------
// SessionManager.cs
//-----------------------------------------------------------------------	
using System.Web;

namespace ITS.Infrastructure.Helpers
{
    public class SessionHelper
    {
        public static T SetSession<T>(string sessionName, T obj)
        {
            HttpContext.Current.Session[sessionName] = obj;
            return obj;
        }

        public static T GetSession<T>(string sessionName)
        {
            if (HttpContext.Current.Session[sessionName] == null) return default(T);
            return (T)HttpContext.Current.Session[sessionName];
        }

        public static void ClearSession(string sessionName)
        {
            HttpContext.Current.Session.Remove(sessionName);
        }

        public static bool IsNull(string sessionName)
        {
            return HttpContext.Current.Session[sessionName] == null;
        }
    }
}
